var list = {
  typeId: '',
  typeName: '',
  number: 12,
  page: 1,
  data: [],
  focusId: '',
  totalPage: -1,
  elId: 'list-container',
  loading: false,
  init: function(){
    this.renderTitle()
    this.getData()
  },
  renderTitle: function(){
    $('#title').html(this.typeName)
  },
  renderPage: function(){
    this.totalPage = Math.ceil(this.total / this.number)
    $('#page').html('第<span class="color">' + this.page + '</span>页 / 共<span class="color">' + this.totalPage + '</span>页')
  },
  getData: function(){
    this.loading = true
    var data = getVodListByTypeId({
      TYPEID: this.typeId,
      LENGTH: this.number,
      STATION: this.page
    })
    this.loading = false
    page.data.list = data.data
    // this.data = data.data;
    this.total = data.total
    this.renderList()
  },
  renderList: function(){
    var html = '';
    var list = page.data.list
    if (this.total > 0) {
      for (var i = 0; i < list.length; i++){
        var flag = list[i].charge == 0 ? utils.useStatus('free') : ''
        var imgSrc = utils.toImgUrl(list[i].picture[0].picPath0);
        html += '<div id="list-' + i + '" class="item">'
        html += flag
        html += '<img src="' + imgSrc + '"/>'
        html += '</div>'
      }
      this.renderPage();
    } else {
      $('#page').html('');
      html = '<div class="empty">暂无数据</div>';
    }
    $('#' + this.elId).html(html);
  }
}